/**
 * Created by sergey on 16.06.2014.
 */
public class EquationSolver {
    double d,b;
    double x1, x2;
    EquationSolver(double d, double b){
        this.b = b;
        this.d = d;
    }
    public void solve(double d, double b){
        if (d>0){
            x1 = ((-1) * b + Math.sqrt(d)) / 2;
            x2 = ((-1) * b - Math.sqrt(d)) / 2;
            System.out.printf("x1 = " + x1 + " x2 = " + x2);}
        else if (d == 0){
            x1 = (-1) * b;
            System.out.printf("x1, x2 = " + x1);
        }
        else
            System.out.print("Error. D less than 0");
    }
}
